<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 数据表格</title>
<#include "../comm/commcss/commCss.ftl">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>基本
                        <small>模板列表</small>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="${base}/city/add.show">新增</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class="table table-striped table-bordered table-hover dataTables-tpl"
                           id="dataTables-tpl">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>描述</th>
                            <th>模板内容</th>
                            <th>渠道来源</th>
                            <th>模板类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list sysTemplateList as p>
                        <tr class="gradeA">
                            <td>${p.id}</td>
                            <td>${p.tplName}</td>
                            <td><input type="hidden" id="content_${p.id}" value="${p.tplContent}">.....</td>
                            <td>${p.tplType}</td>
                            <td>${p.channelType}</td>
                            <td>
                                <div class="text-center">
                                    <button type="button" class="btn btn-primary" data-toggle="modal"
                                            data-target="#myModal5" onclick="showScriptDiv(${p.id},this)">
                                        脚本执行
                                    </button>
                                </div>
                            </td>
                        </tr>
                        </#list>
                        </tbody>
                        <tfoot>
                        <tr>
                            <th>id</th>
                            <th>描述</th>
                            <th>模板内容</th>
                            <th>渠道来源</th>
                            <th>模板类型</th>
                            <th>操作</th>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal inmodal fade" id="myModal5" tabindex="-1" role="dialog"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span
                        aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
            <#--<h4 class="modal-title">窗口标题</h4>-->
            </div>
            <div class="modal-body">
                <p><strong>模板配置</strong>
                <form name="createScriptForm" id="createScriptForm">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            模板
                        </div>
                        <div class="panel-body">
                            <textarea class="form-control" id="templateContent" name="tplContent" rows="20"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                    <div class="input-group m-b">
                        <div class="input-group-btn">
                            <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"
                                    aria-expanded="false">操作 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" id="selectTable">
                                <li class="divider"></li>
                                <li><a href="form_basic.html#">选项4</a>
                                </li>
                            </ul>

                        </div>
                        <input type="text" class="form-control" name="tableName" id="selectTabValue" style="width: 40%">
                        <button type="button" id="closeBtn" class="btn btn-white" data-dismiss="modal">
                            关闭
                        </button>
                        <button type="button" class="btn btn-primary" id="yuLanBtn"> 预览</button>
                        <button type="button" class="btn btn-primary" id="createScriptBtn">保存</button>
                        <input type="hidden" value="" name="id" id="temp_id">
                        <#--<input type="hidden" value="" name="templatetype" id="templatetype">-->
                        <input type="hidden" name="yuLan" id="yuLan_hid" value="true">
                    </div>
                </div>
                </form>
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        生成类预览
                    </div>
                    <div class="panel-body">
                        <textarea class="form-control" id="templateContentYuLan" rows="20"></textarea>
                    </div>
                </div>
                </p>
            </div>
        </div>
    </div>
</div>
<#include "${base}/comm/commjs/commJs.ftl">
<!-- Sweet alert -->
<script src="${base_oss}/js/plugins/sweetalert/sweetalert.min.js"></script>
<!-- 自定义js -->
<script src="${base}/js/content.js?v=1.0.0"></script>
<script src="${base}/myjs/sys/systemplate.js?v=1.0.0"></script>
<script>
    $(document).ready(function () {

        //初始化表格
        $('.dataTables-tpl').dataTable();

        //生成预览
        $('#yuLanBtn').click(function () {
            templateUtils.yuLanDo();
        });
        //更新模板内容
        $('#createScriptBtn').click(function () {
            templateUtils.updateDo();
        });
        //选择table
        $('#selectTable').on("click", "li", function () {
            $("#selectTabValue").val($(this).text());
        });
//        关闭
        $('#closeBtn').click(function () {
            $("#templateContentYuLan").val('');
            $("#templateContent").val('');
        });
    });

</script>
</body>

</html>
